<?php
/**
 * Copyright (C), 2021-2021, Shall Buy Life info. Co., Ltd.
 * FileName: CourseRequest.php
 * Description: 说明
 *
 * @author lwl
 * @Create Date    2021/8/16 13:28
 * @Update Date    2021/8/16 13:28 By lwl
 * @version v1.0
 */

namespace Example\Requests;

class ExampleRequest extends BaseRequest
{

    /**
     * 验证场景器
     * @var \string[][]
     */
    public $scenes = [
        'create' => ['title'],
        'update' => ['title', 'id'],
    ];

    /**
     * FunctionName：authorize
     * Description：鉴权
     * Author：lwl
     * @return bool
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * FunctionName：rules
     * Description：验证规则
     * Author：lwl
     * @return string[]
     */
    public function rules(): array
    {
        return self::baseRules();

    }

    /**
     * FunctionName：baseRules
     * Description：
     * Author：lwl
     * @return string[]
     */
    private static function baseRules():array
    {
        return [
            'title' => 'required'
        ];
    }

    /**
     * FunctionName：attributes
     * Description：
     * Author：lwl
     * @return string[]
     */
    public function attributes():array
    {
        return [
            'title' => '名称',
        ];
    }

    /**
     * FunctionName：messages
     * Description：规则提示
     * Author：lwl
     * @return string[]
     */
//    public function messages(): array
//    {
//        return [
//            'title.required' => '标题必须'
//        ];
//    }
}
